package com.sunrise.generico.entidade;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import lombok.Getter;
import lombok.Setter;

import com.sunrise.generico.entidade.iface.EntidadeManter;
import com.sunrise.generico.enums.Status;
import com.sunrise.generico.enums.TipoVenda;

@Entity
@Table(name = "venda")
public class Venda implements EntidadeManter {

	/**
	 * 
	 */
	private static final long serialVersionUID = -307041236011097321L;

	@Id
	@SequenceGenerator(name="pk_sequence",sequenceName="venda_id_seq", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="pk_sequence")
	@javax.persistence.Column
	@Getter @Setter
	private Long id;
	
	@Column(name = "nome", length = 200)
	@Getter @Setter
	private String nome;
	
	@Column(name = "valorBruto")
	@Getter @Setter
	private BigDecimal valorBruto;
	
	@Column(name = "valorLiquido")
	@Getter @Setter
	private BigDecimal valorLiquido;
	
	@Column(name = "dataVenda")
	@Getter @Setter
	private Date dataVenda;
	
	@Column(name = "dataEntrega")
	@Getter @Setter
	private Date dataEntrega;
	
	@Column(name = "seguro")
	@Getter @Setter
	private BigDecimal seguro;
	
	@Column(name = "despesas")
	@Getter @Setter
	private BigDecimal despesas;
	
	@Column(name = "frete")
	@Getter @Setter
	private BigDecimal frete;
	
	@ManyToOne
	@Getter @Setter
	private Filial filial;

	@OneToOne
	@Getter @Setter
	private Pagamento pagamento;

	@NotNull(message = "{tipoVendaObrigatorio}")
	@Enumerated
	@Getter @Setter
	private TipoVenda tipoVenda;

	@OneToMany
	@Getter @Setter
	private Collection<VendaProduto> vendaProdutos;
	
	@Enumerated
	@Getter @Setter
	private Status statusVenda;

}
